MintRally の実装を見ていく
2023-06-02 時点での自分用メモ。情報が古くなっているかもなのでご留意ください。
情報ズ
https://www.mintrally.xyz/
https://github.com/hackdays-io/mint-rally
https://opensea.io/collection/mintrally-xyz
https://polygonscan.com/token/0x7d895ca96caa5344ec0b732c6e1defa560671e14
https://scrapbox.io/files/6479b923e9765d001ccff94d.webp
スマートコントラクト
https://github.com/hackdays-io/mint-rally/blob/main/README.md によれば
contract: Solidity, ERC721Enumerable, Hardhat
image: IPFS, Pinata
このへんを見るといい? https://github.com/hackdays-io/mint-rally/tree/main/hardhat/contracts
https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/ERC2771ContextUpgradeable.sol
ERC-2771 って知らないやつだ
https://eips.ethereum.org/EIPS/eip-2771
EIP を読んだけどピンとこなかった
メタトランザクションとは - Zenn
(余談) なんか ChatGPT っぽい文体だな、という不思議な感覚を抱いた
なるほど、アプリケーションのエンドユーザの代わりにガス代を払う仲介者を置けるっぽい
登場人物、これらを語彙として押さえておけるとよさそう
Transaction Signer
Gas Relay
Trusted Forwarder
Recipient
OpenZeppelin にもあるみたい
openzeppelin-contracts/ERC2771Context.sol at master · GitHub
https://docs.openzeppelin.com/contracts/4.x/api/metatx
Defender Relay の話の中でもちょろっと触れられている
https://docs.openzeppelin.com/defender/relay
OpenZeppelin のやつは _trustedForwarder が immutable だけど、こっちはそうじゃない
https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/MintNFT.sol
is ERC721EnumerableUpgradeable, ERC2771ContextUpgradeable, OwnableUpgradeable
いわゆる NFT で、Gas Relay 対応していて、オーナーならコントラクトを更新できる
https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/IMintNFT.sol
MintNFT のインターフェイス
https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/Forwarder.sol
Forwarder だ
verify して execute する、ってことね
is EIP712
https://eips.ethereum.org/EIPS/eip-712 は過去に EIP-712 を理解したい で調べた
署名のとき、構造化されているデータが読みやすいってやつだね
https://github.com/hackdays-io/mint-rally/blob/main/hardhat/contracts/Event.sol
ファイル名は Event.sol だけど定義しているのは EventManager なのね
Event 関連の処理をこのファイルにまとめているっぽい
https://polygonscan.com/token/0x7d895ca96caa5344ec0b732c6e1defa560671e14#writeContract
Polygonscan を見ると Owner がどんな操作をできるのか把握できる
Web UI
https://github.com/hackdays-io/mint-rally/blob/main/README.md によれば
frontend: Next.js, Typecript
Next.js と TypeScript ね〜
Typecript になっていたので Pull Request を出した
https://github.com/hackdays-io/mint-rally/pull/256
https://github.com/hackdays-io/mint-rally/blob/main/frontend/package.json
thirdweb の SDK を使っているのね
https://github.com/hackdays-io/mint-rally/blob/main/frontend/yarn.lock
npm じゃなくて yarn を使っているっぽい
https://github.com/hackdays-io/mint-rally/blob/main/docs/frontend.md に書いてあった
https://github.com/hackdays-io/mint-rally/blob/main/frontend/src/pages/index.tsx
Next.js 製のアプリケーションとして、ここから順番に読んでいけばいいかな
Pinata https://www.pinata.cloud/
へぇ、知らなかった